package org.benjamin.lending.domain.entity;

import java.math.BigDecimal;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.CreationTimestamp;

@Entity
@Table(name = "tab_member_money_log")
public class MemberMoneyLog {
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	
	@ManyToOne
	@JoinColumn(name = "member_id",nullable = false)
	private MemberInfo memberInfo;
	
	@Column(name = "rel")
	private Integer rel;
	
	@Enumerated(EnumType.STRING)
	@Column(name = "transactType")
	private TransactType transactType;
	
	@Enumerated(EnumType.STRING)
	@Column(name = "inp_out",nullable = false)
	private InpOut inpOut;
	
	@Enumerated(EnumType.STRING)
	@Column(name = "type",nullable = false)
	private Type type;
	
	@Column(name = "info",nullable = false)
	private String info;
	
	@Column(name = "affect_money",nullable = false,scale = 2)
	private BigDecimal affectMoney;
	
	@Column(name = "balance_money",nullable = false,scale = 2)
	private BigDecimal balaceMoney;
	
	@Column(name = "balace_loan_affect",nullable = false,scale = 2)
	private BigDecimal balaceLoanAffect = BigDecimal.ZERO;
	
	@Column(name = "balace_reward_affect",nullable = false,scale = 2)
	private BigDecimal balaceRewardAffect = BigDecimal.ZERO;
	
	@Column(name = "balace_recharge_affect",nullable = false,scale = 2)
	private BigDecimal balaceRechargeAffect = BigDecimal.ZERO;
	
	@Column(name = "balace_repayment_affect",nullable = false,scale = 2)
	private BigDecimal balaceRepaymentAffect = BigDecimal.ZERO;
	
	@Column(name = "freeze_money",nullable = false,scale = 2)
	private BigDecimal freezeMoney;
	
	@Column(name = "create_time",nullable = false)
	@CreationTimestamp
	private Timestamp createTime;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public MemberInfo getMemberInfo() {
		return memberInfo;
	}

	public void setMemberInfo(MemberInfo memberInfo) {
		this.memberInfo = memberInfo;
	}

	public Integer getRel() {
		return rel;
	}

	public void setRel(Integer rel) {
		this.rel = rel;
	}

	public TransactType getTransactType() {
		return transactType;
	}

	public void setTransactType(TransactType transactType) {
		this.transactType = transactType;
	}

	public InpOut getInpOut() {
		return inpOut;
	}

	public void setInpOut(InpOut inpOut) {
		this.inpOut = inpOut;
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	public BigDecimal getAffectMoney() {
		return affectMoney;
	}

	public void setAffectMoney(BigDecimal affectMoney) {
		this.affectMoney = affectMoney;
	}

	public BigDecimal getBalaceMoney() {
		return balaceMoney;
	}

	public void setBalaceMoney(BigDecimal balaceMoney) {
		this.balaceMoney = balaceMoney;
	}

	public BigDecimal getBalaceLoanAffect() {
		return balaceLoanAffect;
	}

	public void setBalaceLoanAffect(BigDecimal balaceLoanAffect) {
		this.balaceLoanAffect = balaceLoanAffect;
	}

	public BigDecimal getBalaceRewardAffect() {
		return balaceRewardAffect;
	}

	public void setBalaceRewardAffect(BigDecimal balaceRewardAffect) {
		this.balaceRewardAffect = balaceRewardAffect;
	}

	public BigDecimal getBalaceRechargeAffect() {
		return balaceRechargeAffect;
	}

	public void setBalaceRechargeAffect(BigDecimal balaceRechargeAffect) {
		this.balaceRechargeAffect = balaceRechargeAffect;
	}

	public BigDecimal getBalaceRepaymentAffect() {
		return balaceRepaymentAffect;
	}

	public void setBalaceRepaymentAffect(BigDecimal balaceRepaymentAffect) {
		this.balaceRepaymentAffect = balaceRepaymentAffect;
	}

	public BigDecimal getFreezeMoney() {
		return freezeMoney;
	}

	public void setFreezeMoney(BigDecimal freezeMoney) {
		this.freezeMoney = freezeMoney;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public enum InpOut{
		INPUT,OUTPUT
	}
	
	public enum Type{
		USER_RECHARGE,USER_WITHDRAW_ACCEPT,USER_WITHDRAW_RECEIVED
	}

}
